package com.czb.wisdomcashier;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 描述：NDK通讯数据
 * ChlNo、  枪通道
 * NZL、    逻辑枪号
 * PumpTTC、油机流水号
 * MDCTTC、 MDC流水号
 * 时间： 2020/7/14.
 * 创建： 北京研发中心 zzt
 */
public class FccOilGunBean implements Parcelable {

    public FccOilGunBean() {
    }

    /**
     * MDC生成的交易流水号1-0xFFFFFFFF，每通道内唯一，不重复
     */
    public int MDCTTC;
    /**
     * 油机生成的交易流号（各品牌油机不一样，可能会重复）
     */
    public int PumpTTC;
    /**
     * ChlNo 枪连接的通道编号：1-16
     */
    public int ChlNo;
    /**
     * 逻辑枪号：1-254，单站一般枪不会超过64把
     */
    public int NZL;
    /**
     * 枪状态: 0: 未知状态(初始), 1：空闲，2：卡入，3：加注中，4：锁定，5：离线
     */
    public int status;
    /**
     * 油品单价（分）
     */
    public int Price;
    /**
     * 油品升数(0.01升为单位，如1.35升，则值为135)
     */
    public int VOL;
    /**
     * 金额（分）
     */
    public int Money;
    /**
     * 油品编号：采用中石化标准油品代码（见附录）
     */
    public int OilCode;
    /**
     * 密度（g/ml）
     */
    public int Density;

    public int Year;
    public int Month;
    public int Day;
    public int Hour;
    public int Min;
    public int Sec;
    /**
     * 当前泵码
     */
    public int VTOT;
    /**
     * 交易起泵码
     */
    public int VTOT0;
    /**
     * 交易止泵码
     */
    public int VTOT1;

    /**
     * 代表不同的事件
     */
    public int EvtId;

    protected FccOilGunBean(Parcel in) {
        ChlNo = in.readInt();
        NZL = in.readInt();
        status = in.readInt();
        Price = in.readInt();
        VOL = in.readInt();
        Money = in.readInt();
        OilCode = in.readInt();
        Density = in.readInt();
        Year = in.readInt();
        Month = in.readInt();
        Day = in.readInt();
        Hour = in.readInt();
        Min = in.readInt();
        Sec = in.readInt();
        VTOT = in.readInt();
        VTOT0 = in.readInt();
        VTOT1 = in.readInt();
        MDCTTC = in.readInt();
        PumpTTC = in.readInt();
        EvtId = in.readInt();
    }

    public static final Creator<FccOilGunBean> CREATOR = new Creator<FccOilGunBean>() {
        @Override
        public FccOilGunBean createFromParcel(Parcel in) {
            return new FccOilGunBean(in);
        }

        @Override
        public FccOilGunBean[] newArray(int size) {
            return new FccOilGunBean[size];
        }
    };

    @Override
    public String toString() {
        return "FccOilGunBean\n       {" +
                "ChlNo=" + ChlNo +
                ", EvtId=" + EvtId +
                ", VTOT=" + VTOT +
                ", NZL=" + NZL +
                ", status=" + status +
                ", Price=" + Price +
                ", VOL=" + VOL +
                ", Money=" + Money +
                ", OilCode=" + OilCode +
                ", Density=" + Density +
                ",\n        Year=" + Year +
                ", Month=" + Month +
                ", Day=" + Day +
                ", Hour=" + Hour +
                ", Min=" + Min +
                ", Sec=" + Sec +
                ", \n        VTOT0=" + VTOT0 +
                ", VTOT1=" + VTOT1 +
                ", MDCTTC=" + MDCTTC +
                ", PumpTTC=" + PumpTTC;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(ChlNo);
        dest.writeInt(NZL);
        dest.writeInt(status);
        dest.writeInt(Price);
        dest.writeInt(VOL);
        dest.writeInt(Money);
        dest.writeInt(OilCode);
        dest.writeInt(Density);
        dest.writeInt(Year);
        dest.writeInt(Month);
        dest.writeInt(Day);
        dest.writeInt(Hour);
        dest.writeInt(Min);
        dest.writeInt(Sec);
        dest.writeInt(VTOT);
        dest.writeInt(VTOT0);
        dest.writeInt(VTOT1);
        dest.writeInt(MDCTTC);
        dest.writeInt(PumpTTC);
        dest.writeInt(EvtId);
    }
}

/*
 *  站端系统需要将订单信息在本地库中存储一份【包含订单的基本信息及优惠信息】，
 *  当平台通知订单支付成功时同样需要更新订单的状态，
 *  在本地生产的流水号规则：设备+油站编号+日期时间+4位数字（如双屏机为T， POS机为P），
 *  向云服务发启支付时需要将本地流水后传到云端。
 */
